<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>助力小哥春节准时回家</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <link rel="stylesheet" type="text/css" href="index.min.css?1568042804452">

    <link rel="stylesheet" href="css/swiper.min.css">
</head>
<body>

<div class="swiper-container" id="p5">
    <img id="toast" src="images/toast.png"/>
    <div class="swiper-wrapper">
        <div class="swiper-slide" id="juan1">
            <textarea id="txt-code" readonly="readonly" value=""></textarea>
            <img class="juan" src="images/juan1.png?1568042804450"/>
        </div>
        <div class="swiper-slide">
            <img id="btn-goURL" src="images/get-juan-go.png?1568042804450"/>
            <img class="juan" src="images/juan2.png?1568042804450"/>
        </div>
    </div>
    <!-- Add Arrows -->
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>
</div>
<div id="orientLayer" class="mod-orient-layer">
    <div class="mod-orient-layer__content"><i class="icon mod-orient-layer__icon-orient"></i>
        <div class="mod-orient-layer__desc">为了更好的体验，请锁定屏幕旋转</div>
    </div>
</div>
<div id="container" style="height:100%;width:100%;position:absolute;bottom: 0px;z-index:10">
    <div id="canvasContainer" style="width:100%;position:absolute;">
        <canvas id="canvas" width="840" height="1480"></canvas>
    </div>
</div>
</body>

<!--<script src="js/jquery-2.0.3.min.js"></script>-->
<script src="js/jquery-2.0.3.min.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="js/weixin.js?version=2.7"></script>

<!--<script src="js/vconsole.min.js"></script>-->

<script src="js/swiper.min.js"></script>

<script src="js/bundle_simp.min.js?1567425508569"></script>
<!--<script src="lib/createjs-2015.11.26.min.js?1546099899941"></script>-->
<!--<script src="lib/jpang2.0.min.js?1546099899939"></script>-->
<!--<script src="lib/mainapp_simp.js?1568042804439"></script>-->

<script>
    /*$(function () {
        pushHistory();
    });
    function pushHistory() {
        window.addEventListener("popstate", function (e) {
            //这里监听到了后退事件
            self.location.reload();
        }, false);
        var state = {
            title: "",
            url: "#"
        };
        window.history.replaceState(state, "", "#");
    }*/


    /*$(function () {
        var isPageHide = false;
        window.addEventListener('pageshow', function () {
            if (isPageHide) {
                window.location.reload();
            }
        });
        window.addEventListener('pagehide', function () {
            isPageHide = true;
        });
    });*/

    // 初始化vConsole
    // window.vConsole = new window.VConsole();


    var hostUrl = "https://wehomeservicedev.dsn2017.com/";
    if (location.origin.indexOf("wehomeservice.dsn2017") !== -1) {
        hostUrl = "https://wehomeservice.dsn2017.com/";
    }
    var shareTitle = "助力小哥春节准时回家";
    var descContent = "微常准与你一起助力小哥春节回家，还能获得京东到家15元优惠券哦！";
    var lineLink = hostUrl + "/expressgame/released/index.html?entry_from=wxshare";
    var imgUrl = hostUrl + "/expressgame/released/share.png?1567356048135";


    var userStatus;

    function tongguan(url, thisVal, callback) {

        thisVal["callback_url"] = encodeURIComponent(window.location.href);
        thisVal["is_offical"] = P.getUrlParam("is_offical") || 0;
        if (location.origin.indexOf("localhost") !== -1 || location.origin.indexOf("192.168.12.9") !== -1) thisVal["test"] = 1;

        $.ajax({
            url: hostUrl + url,
            data: thisVal,
            async: true,
            type: "POST",
            success: function (jsonData) {
                if (jsonData.code == -101) {
                    window.location.href = jsonData["message"]["login_url"];
                } else {
                    // console.log(jsonData);
                    callback && callback(jsonData);
                }
            },
            error: function (e) {
                console.log("userStatus error:", e);
            }
        });
    }

    function removeURLParameter(url, parameter) {
        var urlparts = url.split('?');
        if (urlparts.length >= 2) {
            //参数名前缀
            var prefix = encodeURIComponent(parameter) + '=';
            var pars = urlparts[1].split(/[&;]/g);
            //循环查找匹配参数
            for (var i = pars.length; i-- > 0;) {
                if (pars[i].lastIndexOf(prefix, 0) !== -1) {
                    //存在则删除
                    pars.splice(i, 1);
                }
            }
            return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : '');
        }
        return url;
    }

    var loadJsonpData = function (thisURL, thisVal, callback, callbackparam, callbackType) {
        thisURL = hostUrl + thisURL;
        if (location.origin.indexOf("localhost") !== -1 || location.origin.indexOf("192.168.12.10") !== -1) thisVal['test'] = 1;
        $.ajax({
            url: thisURL,
            data: thisVal,
            async: true,
            type: "POST",
            success: function (jsonData) {
                if (jsonData.code == -101) {
                    window.location.href = jsonData["message"]["login_url"];
                } else {
                    callback(jsonData, callbackparam);
                }
            },
            complete: function () {
                $("#loadingdiv").fadeOut();
            },
        })
    };
    var shareStatus = function () {
        var _url = "api/index/share";
        var param = {};
        param['url'] = window.location.href; //removeURLParameter(window.location.href,"is_offical");	//encodeURIComponent(lineLink);
        param['jsApiList'] = ['getLocation', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideOptionMenu', 'showOptionMenu', 'scanQRCode'];
        param['debug'] = false;
        loadJsonpData(_url, param, function (rst) {
            var wx_conf = rst.data;
            loadWxShare(wx_conf);
        }, param);
        tongguan("api/xiaoge/getUserInfo", {}, function (json) {
            userStatus = json.data;
        });
    };
    shareStatus();

    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge && WeixinJSBridge.call('hideOptionMenu');
    });

    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?401ff2a1413c47706a463d122674ecb2";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();

    var sourcefrom = P.getUrlParam("entry_from");
    var clickEventStat = function (category, clicktype, name) {
        try {
            tongguan("api/trace/trackEvent", {event_name: clicktype, page: name});
            _hmt.push(['_trackEvent', sourcefrom, 'mobile', category + '_' + clicktype]);
        } catch (e) {
            console.log("hm error");
        }
    };
    clickEventStat("", "enter", encodeURIComponent(window.location.href));
</script>
</html>